package com.vsd.repository;


import java.util.Collection;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.rest.core.annotation.RestResource;

import com.vsd.domain.City;

@RestResource(exported = false)
public interface CityRepository extends CrudRepository<City, String> {
	
	Collection<City> findByLevelAndState(Integer level,Integer state,Sort sort);
	
	Collection<City> findByLevelAndParent(Integer level,String parent,Sort sort);
	
	Collection<City> findByCodeLikeAndLevelGreaterThanAndState(String code,Integer level,Integer state,Sort sort);
	
	Collection<City> findByNameAndState(String name,Integer state);
	
	Collection<City> findByCode(String code);
	
	Page<City> findByParent(String parent,Pageable p);
	
	Page<City> findAll(Pageable p);

	Page<City> findByLevel(Integer level,Pageable p);
	
	Collection<City> findByIsHotAndLevelAndState(Integer ishot,Integer level,Integer state,Sort sort);
	
	Collection<City> findByParent(String code,Sort sort);
}
